import { http } from '@/utils/http'
import type { TestDetail, TestResult, TestList, TestHistoryResponse } from '@/types/healthTest'

export const getTestDetailById = (htId: string) => {
  return http<TestDetail[]>({
    url: `/health/healthAll/getTestDetailById/${htId}`,
    method: 'GET'
  })
}
/**
 * 抑郁测试结果 AND EQ测试结果
 * @param data
 */
export const getTestResult = (data: TestDetail[]) => {
  return http<TestResult>({
    method: 'POST',
    url: `/health/healthAll/getTestResult`,
    data: data,
  })
}
/**
 * FPA测试结果
 * @param data
 */
export const getTestResult02 = (data: TestDetail[]) => {
  return http<TestResult>({
    method: 'POST',
    url: `/health/healthAll/getTestResult02`,
    data,
  })
}

/**
 * 获取测试历史记录
 * @param patientId 患者ID
 * @param current 当前页码
 * @param size 每页数量
 */
export const getTestHistory = (current = 1, size = 10) => {
  return http<TestHistoryResponse>({
    method: 'GET',
      url: `/health/healthAll/getTestHistory?current=${current}&size=${size}`,
    data: {
      current,
      size
    }
  })
}

export const getAllHealthTest = () => {
  return http<TestList[]>({
    url: `/health/healthAll/getAllHealthTest`,
  })
}

